package emulator.hardware.clock.test;

import emulator.hardware.clock.Clock;
import emulator.hardware.clock.ClockHandle;

public class WorkerThread extends Thread {
	private ClockHandle clock;
	private int increment;
	private static boolean stop_thread;
	
	WorkerThread(Clock clock, int increment)
	{
		this.clock = clock.acquireHandle();
		this.increment = increment;
		stop_thread = false;
	}

	/* (non-Javadoc)
	 * @see java.lang.Thread#run()
	 */
	@Override
	public void run() {
		while (!stop_thread)
		{
			clock.tick(increment);
		}
	}

	public static void stopThread()
	{
		stop_thread = true;
	}
}
